#ifndef MYELLIPSE_H
#define MYELLIPSE_H
#include "MyShape.h"

class MyEllipse : public MyShape
{
private:
	char* _stroke;
	char* _fill;
	float _strokeWidth;
	int _cx;
	int _cy;
	int _rx;
	int _ry;
public:
	//Default constructor
	MyEllipse() {
		
	}
	//Parameterized constructors
	MyEllipse(char stroke[], char fill[], float strokeWidth, int cx, int cy, int rx, int ry) {
		_stroke = stroke;
		_fill = fill;
		_strokeWidth = strokeWidth;
		_cx = cx;
		_cy = cy;
		_rx = rx;
		_ry = ry;
	}
	//Override methods
	void Draw() {
		this->GetMyGraphic()->DrawEllipse(_stroke, _strokeWidth, _cx - _rx, _cy - _ry, _rx*2, _ry*2);
		
		if(_fill != NULL)
			this->GetMyGraphic()->FillEllipse(_fill, _cx - _rx, _cy - _ry, _rx*2, _ry*2);
	}

	void Move(int xdistance,int ydistance){
		
	}

	void SetColor(char* color);

	void SetEffect(MyEffect* effect){
		MyShape* shapeEffect = new MyEllipse(*this);
		effect->SetShape(shapeEffect);
		effect->DrawEffect();
	}
	string ToString() {
		string s = "";		
		s += "<ellipse cx='";		
		s += MyFunction::IntToString(this->_cx);
		s += "' cy='";
		s += MyFunction::IntToString(this->_cy);
		s += "' rx='";
		s += MyFunction::IntToString(this->_rx);
		s += "' ry='";
		s += MyFunction::IntToString(this->_ry);
		s += "' stroke='rgb(";
		s += MyFunction::Char2String(this->_stroke[0]);
		s += ", ";
		s += MyFunction::Char2String(this->_stroke[1]);
		s += ", ";
		s += MyFunction::Char2String(this->_stroke[2]);
		s += ")' stroke-width='";
		s += MyFunction::FloatToString(this->_strokeWidth);
		if(this->_fill != NULL) {
			s += "' fill='rgb(";
			s += MyFunction::Char2String(this->_fill[0]);
			s += ", ";
			s += MyFunction::Char2String(this->_fill[1]);
			s += ", ";
			s += MyFunction::Char2String(this->_fill[2]);
			s += ")' />";
		}
		else {
			s += "' fill='none' />";
		}

		return s;
	}	
	//Destructor
	~MyEllipse() {
		//delete _stroke;
		//delete _fill;
	}
};
#endif